package org.example.hrpc.example;

import org.example.hrpc.config.RegistryConfig;
import org.example.hrpc.config.service.ServiceConfig;

import javax.print.attribute.standard.PagesPerMinute;
import java.io.IOException;
import java.net.InetSocketAddress;

public class HelloServerRegistry {
    public static void main(String[] args) throws IOException {
        RegistryConfig registryConfig = new RegistryConfig("registry", "127.0.0.1", 2181);
        ServiceConfig<HelloService> serviceConfig = new ServiceConfig<>();
        serviceConfig.addRegistry(registryConfig);

        serviceConfig.setInterfaceClass(HelloService.class);

        serviceConfig.setRef(new HelloServiceImpl());

        serviceConfig.setSocketAddress(InetSocketAddress.createUnresolved("127.0.0.1", 30000));

        serviceConfig.export();
        // 按任意键退出
        System.in.read();
    }
}
